import React from 'react';
import {renderRoutes} from "react-router-config";
import {Button, Card} from "antd";
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import * as actionCreator from './action'

@connect(
    (state) => ({
        count: state.counter.count
    }),
    (dispatch) => ({
        actions: bindActionCreators(actionCreator, dispatch)
    })
)
class Count extends React.Component {
    handleCountChange = () => {
        const {count, actions: {setCount}} = this.props;
        setCount(count + 1)
    };

    render() {
        const {count} = this.props;
        return (
            <Card>
                <h2>Count{count}</h2>
                <Button onClick={this.handleCountChange}>更改数字</Button>
            </Card>
        )
    }
}

export default Count;
